package com.moonshine.dao.impl;

import com.moonshine.dao.EmpDao;
import com.moonshine.pojo.Emp;
import com.moonshine.utils.XmlParserUtils;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;

import java.util.List;


//@Component
@Repository
public class EmpDaoImpl implements EmpDao {


    @Override
    public List<Emp> getEmpList() {
        // 获取数据
        String file = this.getClass().getClassLoader().getResource("emp.xml").getFile();
//        System.out.println("file path: " + file);
        // 解析数据
        List<Emp> empList = XmlParserUtils.parseXml(file, Emp.class);

        return empList;
    }
}
